import { fromJS } from 'immutable'
import * as constants from '../store/constants.js'

const defaultState = fromJS({
  topicList: [],
  articleList: [],
  recommendList: [],
  WriterList: []
})

export default (state = defaultState, action) => {
  switch(action.type){
    case constants.CHANGE_HOME_DATA:
      return state.merge({
        topicList: fromJS(action.topicList),
        articleList: fromJS(action.articleList),
        recommendList: fromJS(action.recommendList),
        WriterList: fromJS(action.WriterList)
      })
    default:
      return state
  }
}